home *** CD-ROM | disk | FTP | other *** search
/ Delphi Magazine Collection 2001 / Delphi Magazine Collection 20001 (2001).iso / DISKS / ISSUE16 / TIPTRIX / LISTING3.PAS < prev    next >
Encoding:
Pascal/Delphi Source File  |  1996-11-15  |  424 b   |  16 lines

  1. procedure PatchExe(const aFile: String; aSerial: Longint);
  2. var
  3.   aPos : Longint;
  4.   aStream : TMemoryFileStream;
  5. begin
  6.   aStream := TMemoryFileStream.Create(aFile, fmOpenReadWrite);
  7.   try
  8.     aPos := PosBM('*MyPatch*',aStream.Memory^, aStream.Size);
  9.     if aPos <> - 1 then
  10.       { - 1 for Length byte ! }
  11.       PPatch(PChar(aStream.Memory)+aPos-1)^.Serial := aSerial;
  12.   finally
  13.     aStream.Free;
  14.   end;
  15. end;
  16.